﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace WpfSnqkGasAnalysis
{
    /// <summary>
    /// 是否显示签名，显示控制。
    /// </summary>
    /// 创建时间：2023-1-6 19:36:10。作者：王浩力
    internal class PrintViewSignImgConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            
            //value   1显示电子签名图片；0不显示
            //parameter ，1=打印文本；2=电子签名图片
            if (value == null && parameter.ToString() == "1")
                return System.Windows.Visibility.Collapsed;
            if (value==null && parameter.ToString() == "2")
            {
                //return System.Windows.Visibility.Collapsed;
                return System.Windows.Visibility.Visible;
            }

            //添加时间：2023-1-14 23:41:57。分析人处理
            if (value == null && parameter.ToString() == "77")
            {
                return System.Windows.Visibility.Collapsed;
                //return System.Windows.Visibility.Visible;
            }

            if (value.ToString() == "1")  //显示电子签名
            {
                if (parameter.ToString() == "1") //打印文本
                {
                    return System.Windows.Visibility.Collapsed;
                }
                else
                {
                    return System.Windows.Visibility.Visible;
                }
            }
            else if (value.ToString() == "0") //不显示电子签名
            {
                //添加时间：2023-1-14 23:41:57。
                if (parameter!=null &&
                    (parameter.ToString() == "77" || parameter.ToString() == "1")
                )
                {
                    //分析人
                    return System.Windows.Visibility.Visible;
                }

                //if (parameter.ToString() == "2")  //电子签名图片
                //{
                //    return System.Windows.Visibility.Collapsed;
                //}
                //return System.Windows.Visibility.Visible;

                //修改时间：2023-1-14 23:37:46
                return System.Windows.Visibility.Collapsed;
            }
             
            return System.Windows.Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
